From b84553e496a3e210c026a4fb6bf6f4576b72e937 Mon Sep 17 00:00:00 2001 From: Paul Donald Date: Sat, 8 Nov 2025 18:43:35 +0100 Subject: [PATCH] router: Modify relayed RA PIO P flag according to interface policy MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Effectively: -inherit the P flag from upstream, but retain the possibility to disable its availability downstream, if any of the following are disabled: -DHCPv6 -DHCPv6-PD -DHCPv6-PD Preferred Signed-off-by: Paul Donald Link: https://github.com/openwrt/odhcpd/pull/317 Signed-off-by: Álvaro Fernández Rojas --- src/router.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/router.c b/src/router.c index 3d1efa1..8334a1c 100644 --- a/src/router.c +++ b/src/router.c @@ -1202,7 +1202,7 @@ static void forward_router_advertisement(const struct interface *iface, uint8_t // MTU option struct nd_opt_mtu *mtu_opt = NULL; uint32_t ingress_mtu_val = 0; - /* PIO L/A flag and RA M/O Flags */ + /* PIO L/A/R/P flag and RA M/O Flags */ uint8_t ra_flags; size_t pio_count = 0; struct fwd_pio_flags { @@ -1295,6 +1295,11 @@ static void forward_router_advertisement(const struct interface *iface, uint8_t */ if (!c->ra_slaac) *pio_flags[i].ptr &= ~ND_OPT_PI_FLAG_AUTO;/* ensure A flag cleared */ + + /* we have no opinion on the R flag - it can be forwarded */ + + if (c->dhcpv6 == MODE_DISABLED || !c->dhcpv6_pd || !c->dhcpv6_pd_preferred) + *pio_flags[i].ptr &= ~ND_OPT_PI_FLAG_PD_PREFERRED;/* ensure P flag (DHCPv6-PD) cleared */ } /* Apply per-interface modifications of upstream RA state */ -- 2.30.2